home *** CD-ROM | disk | FTP | other *** search
- -- background: 14235 from stack: in.2
- -- bmap block id: 35610
- -- flags: 4000
- -- background id: 0
- -- name: Stock Chart
- ----- HyperTalk script -----
- on openBackground
- push recent card
- end openBackground
-
- function frameheight
- return 235
- end frameheight
-
- function framewidth
- return 400
- end framewidth
-
- function framebottom
- return 275
- end framebottom
-
- function frameleft
- return 1
- end frameleft
-
- on OpenCard
- global lineCount
- put the number of lines of field "Data" into lineCount
- repeat with i=1 to 3
- arrowDirection i
- end repeat
- SetforUpdate
- end OpenCard
-
- on AddDate startDate
- put startDate into newDate
- convert newDate to seconds
- put 7*24*3600 into aWeek -- seconds in a week
- put the number of lines of field "data" into lineCount
- repeat with i=1 to lineCount
- put newDate into currentdate
- convert currentdate to dateItems
- put character 3 to 4 of item 1 of currentDate into year
- put item 2 of currentDate into month
- if month<10 then
- put "0"&month into month
- end if
- put item 3 of currentDate into day
- if day<10 then
- put "0"&day into day
- end if
- get line i of field "data"
- put year&month&day&","&it into line i of field "data"
- add aWeek to newDate
- end repeat
- end AddDate
-
- on RedoDate startDate
- set the cursor to 4
- put startDate into newDate
- convert newDate to seconds
- put 7*24*3600 into aWeek -- seconds in a week
- put the number of lines of field "data" into lineCount
- repeat with i=1 to lineCount
- put newDate into currentdate
- convert currentdate to dateItems
- put character 3 to 4 of item 1 of currentDate into year
- put item 2 of currentDate into month
- if month<10 then
- put "0"&month into month
- end if
- put item 3 of currentDate into day
- if day<10 then
- put "0"&day into day
- end if
- get line i of field "data"
- put year&month&day into item 1 of line i of field "data"
- add aWeek to newDate
- end repeat
- end RedoDate
-
-
-
- -- part 1 (button)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=67 top=317 right=336 bottom=87
- -- title width / last selected line: 0
- -- icon id / first selected line: 1014 / 1014
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Prev
- ----- HyperTalk script -----
- on mouseUp
- global firstChart
- visual effect wipe left
- if the number of this card > firstChart then
- go to previous card
- else
- go card "Title Card"
- end if
- end mouseUp
-
-
- -- part 2 (button)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=5 top=319 right=338 bottom=25
- -- title width / last selected line: 0
- -- icon id / first selected line: 21700 / 21700
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Home
- ----- HyperTalk script -----
- on mouseUp
- visual effect iris close
- go home
- end mouseUp
-
-
-
-
- -- part 4 (button)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=423 top=319 right=338 bottom=443
- -- title width / last selected line: 0
- -- icon id / first selected line: 1013 / 1013
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Next
- ----- HyperTalk script -----
- on mouseUp
- global firstChart
- visual effect wipe right
- if the number of this card < the number of cards then
- go to next card
- else
- go card "Title Card"
- end if
- end mouseUp
-
-
- -- part 5 (field)
- -- low flags: 00
- -- high flags: 4007
- -- rect: left=88 top=278 right=342 bottom=423
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Data
- ----- HyperTalk script -----
- on CountItems
- global highItem,lowItem,closeItem,itemCount
- put the number of items of line 1 of field "data" into itemCount
- put 1 into highItem
- put 1 into lowItem
- put 1 into closeItem
- if itemCount = 5 then
- put 3 into highItem
- put 4 into lowItem
- put 5 into closeItem
- else
- if itemCount>1 then
- put 2 into highItem
- put 2 into lowItem
- put 2 into closeItem
- end if
- end if
- end CountItems
-
- on CloseField
- global highItem,lowItem,closeItem
- set the Cursor to 4
- TrimDataPoints
- CountItems
- if closeItem>1 then
- put item 1 of last line of field "data" into field "Date of Last Update"
- else
- put empty into field "Date of Last Update"
- end if
- put maxLine(field "Data",highitem) into field "High"
- put MinLine(field "data",lowItem) into field "Low"
- put item closeItem of last line of field "data" into field "Close"
- end CloseField
-
-
- -- part 6 (button)
- -- low flags: 00
- -- high flags: A001
- -- rect: left=448 top=278 right=325 bottom=485
- -- title width / last selected line: 0
- -- icon id / first selected line: 12074 / 12074
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Plot
- ----- HyperTalk script -----
- on mouseUp
- global upArrow,downArrow,lineCount,itemCount
- global span1,span2,span3
- put the userLevel into saveLevel
- if the userLevel < 3 then set userLevel to 3 -- "Painting"
- set the cursor to 4
- clearScreen
- reset paint
- choose line tool
- set lineSize to 1
- set pattern to 14
- set filled to true
- put frameleft()+3 into horiz
- send closeField to field "Data"
- put the number of items in line 1 of field "Data" into itemCount
- put 6 into horizStep
- put round(horizStep * 3/4) into width
- put 0 into sum5
- put 0 into sum15
- put 0 into sum40
- put field "High" into maxValue
- repeat with i = 1 to lineCount
- get item itemCount of line i of field "data"
- if it is not empty then
- put round(frameheight() * it / maxValue) into height
- drag from horiz,framebottom()-height to horiz,framebottom()-height+width
- put round(height-width/2) into height
- drag from horiz,framebottom()-height to horiz+2,framebottom()-height
- if i>lineCount-span3 then
- add it to sum40
- if i>lineCount-span2 then
- add it to sum15
- if i>lineCount-span1 then
- add it to sum5
- end if
- end if
- end if
- end if
- add horizStep to horiz
- end repeat
- movingAverage sum5,1,span1,itemCount
- movingAverage sum15,2,span2,itemCount
- movingAverage sum40,3,span3,itemCount
- reset paint
- choose browse tool
- set userLevel to saveLevel
- end mouseUp
-
-
-
-
- -- part 10 (field)
- -- low flags: 00
- -- high flags: 0002
- -- rect: left=99 top=20 right=38 bottom=413
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 2
- -- text size: 12
- -- style flags: 256
- -- line height: 16
- -- part name: Stock Name
-
-
- -- part 11 (field)
- -- low flags: 00
- -- high flags: 0002
- -- rect: left=0 top=20 right=38 bottom=100
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 2
- -- text size: 12
- -- style flags: 256
- -- line height: 16
- -- part name: Stock Symbol
-
-
- -- part 12 (field)
- -- low flags: 00
- -- high flags: 0002
- -- rect: left=412 top=20 right=38 bottom=512
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 2
- -- text size: 12
- -- style flags: 256
- -- line height: 16
- -- part name: Date of last update
-
-
- -- part 13 (field)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=412 top=37 right=55 bottom=512
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 10
- -- style flags: 256
- -- line height: 13
- -- part name: High
-
-
- -- part 14 (field)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=412 top=54 right=72 bottom=512
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 10
- -- style flags: 256
- -- line height: 13
- -- part name: Low
-
-
- -- part 15 (field)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=412 top=71 right=89 bottom=512
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 10
- -- style flags: 256
- -- line height: 13
- -- part name: Close
-
-
- -- part 23 (field)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=411 top=121 right=139 bottom=499
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 10
- -- style flags: 256
- -- line height: 13
- -- part name: Average 1
-
-
- -- part 24 (field)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=411 top=138 right=156 bottom=499
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 10
- -- style flags: 256
- -- line height: 13
- -- part name: Average 2
-
-
- -- part 25 (field)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=411 top=155 right=172 bottom=499
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 10
- -- style flags: 256
- -- line height: 13
- -- part name: Average 3
-
-
- -- part 28 (button)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=497 top=155 right=171 bottom=511
- -- title width / last selected line: 0
- -- icon id / first selected line: 16692 / 16692
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: direction 3
- ----- HyperTalk script -----
- on mouseUp
- end mouseUp
-
-
-
- -- part 29 (button)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=497 top=138 right=154 bottom=511
- -- title width / last selected line: 0
- -- icon id / first selected line: 16692 / 16692
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: direction 2
- ----- HyperTalk script -----
- on mouseUp
- end mouseUp
-
-
-
- -- part 30 (button)
- -- low flags: 00
- -- high flags: 0000
- -- rect: left=497 top=121 right=137 bottom=511
- -- title width / last selected line: 0
- -- icon id / first selected line: 16692 / 16692
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: direction 1
- ----- HyperTalk script -----
- on mouseUp
- end mouseUp
-
-
-
- -- part 31 (field)
- -- low flags: 81
- -- high flags: 0000
- -- rect: left=156 top=120 right=169 bottom=290
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Directions
-
-
- -- part 32 (button)
- -- low flags: 00
- -- high flags: 8000
- -- rect: left=28 top=278 right=322 bottom=60
- -- title width / last selected line: 65535
- -- icon id / first selected line: -6047 / 59489
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Import
- ----- HyperTalk script -----
- on mouseUp
- ask "File Name" with "Interchange:"
- put it into fileName
- open file fileName
- read from file fileName for 32000
- put it into field "data"
- close file fileName
- send closeField to field "data"
- end mouseUp
-
-
-
- -- part 33 (button)
- -- low flags: 00
- -- high flags: 2000
- -- rect: left=492 top=319 right=338 bottom=510
- -- title width / last selected line: 0
- -- icon id / first selected line: 1012 / 1012
- -- text alignment: 1
- -- font id: 0
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: To Title Card
- ----- HyperTalk script -----
- on mouseUp
- go to card "Title Card"
- end mouseUp
-
-